package com.project.weimi.fragment;

import java.util.ArrayList;

import com.project.weimi.R;
import com.project.weimi.activity.OrderDetailsActivity;
import com.project.weimi.adapter.AllOrder_Adapter;
import com.project.weimi.entity.response.OrderEntity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SearchViewCompat.OnCloseListenerCompat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;

/**
 * 全部订单
 * 
 * @author WUSC
 *
 */
public class AllOrder_Fragment extends BaseFragment {
	private View view;
	private ListView all_order_lv;
	private ArrayList<OrderEntity> list;
	public static AllOrder_Adapter adapter;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		view = inflater.inflate(R.layout.all_order_activity, null);

		initView();
		return view;
	}


	private void initView() {
		// TODO Auto-generated method stub
		all_order_lv = (ListView) view.findViewById(R.id.all_order_lv);

		list = new ArrayList<OrderEntity>();
		for (int i = 0; i < 10; i++) {
			list.add(new OrderEntity("交易成功", 22.80, "可爱卡通沙发冰垫小号笔记本散热垫汽" + "\n" + "车降温凉垫学生座椅并冰垫子", "绿色青蛙", 3, 15.20, 7.61,
					"删除订单", "评价", R.drawable.a));
		}

		adapter = new AllOrder_Adapter(getActivity(), list);
		all_order_lv.setAdapter(adapter);
		all_order_lv.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				
				
				Intent intent = new Intent(getActivity(), OrderDetailsActivity.class);
				getActivity().startActivity(intent);
			}
		});
	}
}
